package edu.gyc.hiblog.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import edu.gyc.hiblog.model.Comment;
import edu.gyc.hiblog.dao.CommentDao;
import edu.gyc.hiblog.service.CommentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import edu.gyc.hiblog.service.UserService;
import edu.gyc.hiblog.vo.CommentVo;
import edu.gyc.hiblog.vo.PostVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ls
 * @since 2020-11-30
 */
@Service
public class CommentServiceImpl extends ServiceImpl<CommentDao, Comment> implements CommentService {
@Autowired
CommentDao commentDao;

    @Override
    public PageInfo<CommentVo> paging(Integer pageNum,Long postId,Long userId) {
        PageHelper.startPage(pageNum, 2);

        List<CommentVo> commentVos = commentDao.selectCommentVo(postId, userId);
        PageInfo<CommentVo> pageData = new PageInfo<>(commentVos);

        return pageData;
    }
}
